﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DapperExtensions.Mapper;
using Newtonsoft.Json;
using ZilLion.Service.Core.Domain.EntityBase.JsonConverter;

namespace ZL.CRM.CommonEntity.Common
{
    public class ThrPayLog
    {
        /// <summary>
        ///  微信转账操作流水号(支付/退款)
        /// </summary>
        public string Tllsh { get; set; }

        /// <summary>
        ///  客户注册编码[cousercode 3位]+随机附加值left（(通过newid()去除"-"生成)，17）[20位]
        /// </summary>
        public string Tlfjz { get; set; }

        /// <summary>
        ///  本地业务生效时间(自然时间)
        /// </summary>
        [JsonConverter(typeof(ChinaDateTimeConverter))]
        public DateTime Tlsj { get; set; }

        /// <summary>
        ///  发生地点id(分支机构)
        /// </summary>
        public int Tlddid { get; set; }

        /// <summary>
        ///  发生地点（固定地点：手机微信充值）
        /// </summary>
        public string Tlddmc { get; set; }

        /// <summary>
        ///  企业号账号（appid）
        /// </summary>
        public string Tlqyh { get; set; }

        /// <summary>
        ///  商户号id
        /// </summary>
        public string Tlmchid { get; set; }

        /// <summary>
        ///  操作人名称
        /// </summary>
        public string Tlczrmc { get; set; }

        /// <summary>
        ///  充值金额
        /// </summary>
        public decimal Tlglywje { get; set; }

        /// <summary>
        ///  微信支付订单号
        /// </summary>
        public string Tljylsh { get; set; }

        /// <summary>
        ///  用户标识 openid
        /// </summary>
        public string Tlyhbj { get; set; }

        /// <summary>
        ///  是否关注公众账号0-否1-是
        /// </summary>
        public short Tlgzzhbj { get; set; }

        /// <summary>
        ///  付款银行
        /// </summary>
        public string Tlfkyh { get; set; }

        /// <summary>
        ///  有效标记（目前也表示业务是否成立）
        /// </summary>
        public short Tlsjyxbj { get; set; }

        /// <summary>
        ///  有效标记说明
        /// </summary>
        public string Tlsjyxbjsm { get; set; }

        /// <summary>
        ///  支付状态标记。0-未知 1-成功 2-失败
        /// </summary>
        public short Tlsjzfbj { get; set; }

        /// <summary>
        ///  支付状态标记说明
        /// </summary>
        public string Tlsjzfbjsm { get; set; }

        /// <summary>
        ///  支付状态说明(针对失败/未知的错误说明)
        /// </summary>
        public string Tlsjzfsm { get; set; }

        /// <summary>
        ///  支付过程中发生的返回字符串
        /// </summary>
        public string Tlsjcxzffhwj { get; set; }

        /// <summary>
        ///  业务制单日
        /// </summary>
        [JsonConverter(typeof(ChinaDateTimeConverter))]
        public DateTime Tlglywyyr { get; set; }

        /// <summary>
        ///  业务界面名称。显示字段。
        /// </summary>
        public string Tlglywjmmc { get; set; }

        /// <summary>
        ///  业务摘要信息。(充值说明)（crm操作记录流水号（服务生成）|微信凭证号|本地业务生效时间|充现金|充增值|窗口名称="手机微信充值"|业务摘要|核算机构id|核算机构名称）
        /// </summary>
        public string Tlglywxx { get; set; }

        /// <summary>
        /// crm操作记录流水号
        /// </summary>
        public string Tlzxzhczlsh { get; set; }

        /// <summary>
        ///  退款金额
        /// </summary>
        public decimal Tltkje { get; set; }

        /// <summary>
        ///  退款状态标记说明(成功/失败/未知)
        /// </summary>
        public string Tltkztsm { get; set; }

        /// <summary>
        ///  退款用：对应支付微信转账操作流水号
        /// </summary>
        public string Tlzflsh { get; set; }

    }
    public class WeixinPayLogMapper : ClassMapper<ThrPayLog>
    {
        public WeixinPayLogMapper()
        {
            Table("#ThrPayLog");
            Map(f => f.Tllsh).Column("Tllsh");
            Map(f => f.Tlfjz).Column("Tlfjz");
            Map(f => f.Tlsj).Column("Tlsj");
            Map(f => f.Tlddid).Column("Tlddid");
            Map(f => f.Tlddmc).Column("Tlddmc");
            Map(f => f.Tlqyh).Column("Tlqyh");
            Map(f => f.Tlmchid).Column("Tlmchid");
            Map(f => f.Tlczrmc).Column("Tlczrmc");
            Map(f => f.Tlglywje).Column("Tlglywje");
            Map(f => f.Tljylsh).Column("Tljylsh");
            Map(f => f.Tlyhbj).Column("Tlyhbj");
            Map(f => f.Tlgzzhbj).Column("Tlgzzhbj");
            Map(f => f.Tlfkyh).Column("Tlfkyh");
            Map(f => f.Tlsjyxbj).Column("Tlsjyxbj");
            Map(f => f.Tlsjyxbjsm).Column("Tlsjyxbjsm");
            Map(f => f.Tlsjzfbj).Column("Tlsjzfbj");
            Map(f => f.Tlsjzfbjsm).Column("Tlsjzfbjsm");
            Map(f => f.Tlsjzfsm).Column("Tlsjzfsm");
            Map(f => f.Tlsjcxzffhwj).Column("Tlsjcxzffhwj");
            Map(f => f.Tlglywyyr).Column("Tlglywyyr");
            Map(f => f.Tlglywjmmc).Column("Tlglywjmmc");
            Map(f => f.Tlglywxx).Column("Tlglywxx");
            Map(f => f.Tlzxzhczlsh).Column("Tlzxzhczlsh");
            Map(f => f.Tltkje).Column("Tltkje");
            Map(f => f.Tltkztsm).Column("Tltkztsm");
            Map(f => f.Tlzflsh).Column("Tlzflsh");

        }
    }
}
